<template>
  <el-row :gutter="24" class="panel-group">
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel">
        <div class="card-panel-icon-wrapper icon-people">
          <el-icon :size="20" color="black"><Search /></el-icon>
        </div>
        <div class="card-panel-description text_color">
          <el-statistic class="growth-statistic"  title="高中单词" :value="total.num1"/>
        </div>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel">
        <div class="card-panel-icon-wrapper icon-message">
          <el-icon :size="20" color="black"><MessageBox/></el-icon>
        </div>
        <div class="card-panel-description text_color">
          <el-statistic class="growth-statistic" title="初中单词" :value="total.num2"/>
        </div>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel">
        <div class="card-panel-icon-wrapper icon-money">
          <el-icon :size="20" color="black"><Service /></el-icon>
        </div>
        <div class="card-panel-description text_color">
          <el-statistic class="growth-statistic" title="雅思词汇" :value="total.num3"/>
        </div>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel">
        <div class="card-panel-icon-wrapper icon-shopping">
          <el-icon :size="20" color="black"><Film /></el-icon>
        </div>
        <div class="card-panel-description text_color">
          <el-statistic class="growth-statistic" title="四级词汇" :value="total.num4"/>
        </div>
      </div>
    </el-col>
  </el-row>
</template>

<script setup>

import {Film, MessageBox, Search, Service} from "@element-plus/icons-vue";

const total = {}

function initPage() {
  total.num1 = 1971
  total.num2 = 2660
  total.num3 = 2044
  total.num4 = 4450
}

initPage();
</script>

<style lang="scss" scoped>

/*  修改带增长动画的统计组件样式 */
:deep(.growth-statistic) {
  padding: 5px 20px;
  border-radius: 6px;
}

:deep(.el-statistic__head) {
  font-size: 16px;
}

/* 增长数值样式（使用 value-style 属性也可直接设置） */
:deep(.growth-statistic .el-statistic__content-value) {
  font-size: 36px;
  font-weight: bold;
}

/* 增长标签样式 */
:deep(.growth-statistic .el-statistic__label) {
  color: #67c23a;
  font-weight: 500;
  margin-top: 10px;
}

.text_color{
  background: #f8c471;
  border-radius: 16px;
}

.panel-group {
  margin-top: 18px;

  .card-panel-col {
    margin-bottom: 24px;
  }

  .card-panel {
    height: 108px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    background: #fff;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
    border-color: rgba(0, 0, 0, .05);

    & {
      .card-panel-icon-wrapper {
        color: #fff;
      }

      .icon-people {
        background: #40c9c6;
      }

      .icon-message {
        background: #36a3f7;
      }

      .icon-money {
        background: #f4516c;
      }

      .icon-shopping {
        background: #34bfa3
      }
    }

    .icon-people {
      color: #40c9c6;
    }

    .icon-message {
      color: #36a3f7;
    }

    .icon-money {
      color: #f4516c;
    }

    .icon-shopping {
      color: #34bfa3
    }

    .card-panel-icon-wrapper {
      float: left;
      margin: 14px 0 0 14px;
      padding: 16px;
      transition: all 0.38s ease-out;
      border-radius: 6px;
    }

    .card-panel-icon {
      float: left;
      font-size: 48px;
    }

    .card-panel-description {
      float: right;
      font-weight: bold;
      margin: 2rem 1rem 1rem 0;
    }
  }
}
</style>
